class Singletonlazy{
    private static Singletonlazy instance = null;
    private static Object locker = new Object();
    public static Singletonlazy getInstance() {
        if(instance == null){
            synchronized (locker){
                if(instance == null){
                    instance = new Singletonlazy();
                }
            }
        }
        return instance;
    }
    private Singletonlazy(){ }
}
 class Singleton {
    private static Singleton instance = new Singleton();

    public static Singleton getInstance() {
        return instance;
    }
    private Singleton(){ }
}
public class SingleTest{
    public static void main(String[] args) {
        Singletonlazy s1 = Singletonlazy.getInstance();
        Singletonlazy s2 = Singletonlazy.getInstance();
        System.out.println(s1==s2);

    }
}

